add_executable(rigged-simple WIN32 MACOSX_BUNDLE
    main.cpp
)
qt_add_qml_module(rigged-simple
    URI rigged_simple
    VERSION ${PROJECT_VERSION}
    QML_FILES
        main.qml
        DefaultSceneEntity.qml
        SkinnedEntity.qml
        SkinnedPbrEffect.qml
    RESOURCES
        skinnedPbr.vert
    NO_RESOURCE_TARGET_PATH
)

target_link_libraries(rigged-simple PRIVATE
    Qt${QT_VERSION_MAJOR}::3DAnimation
    Qt${QT_VERSION_MAJOR}::3DCore
    Qt${QT_VERSION_MAJOR}::3DInput
    Qt${QT_VERSION_MAJOR}::3DQuick
    Qt${QT_VERSION_MAJOR}::3DQuickExtras
    Qt${QT_VERSION_MAJOR}::3DRender
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    Qt${QT_VERSION_MAJOR}::Qml
    Qt${QT_VERSION_MAJOR}::Quick
)


# Resources:
set(cubemaps_resource_files
    "../../../examples/qt3d/exampleresources/assets/cubemaps/default/default_irradiance.dds"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/default/default_specular.dds"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/miramar/miramar_negx.webp"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/miramar/miramar_negy.webp"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/miramar/miramar_negz.webp"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/miramar/miramar_posx.webp"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/miramar/miramar_posy.webp"
    "../../../examples/qt3d/exampleresources/assets/cubemaps/miramar/miramar_posz.webp"
)

qt_add_resources(rigged-simple "cubemaps"
    PREFIX
        "/"
    BASE
        "../../../examples/qt3d/exampleresources"
    FILES
        ${cubemaps_resource_files}
)
set(envmaps_resource_files
    "../../../examples/qt3d/exampleresources/assets/envmaps/cedar-bridge/cedar_bridge_irradiance.dds"
    "../../../examples/qt3d/exampleresources/assets/envmaps/cedar-bridge/cedar_bridge_specular.dds"
)

qt_add_resources(rigged-simple "envmaps"
    PREFIX
        "/"
    BASE
        "../../../examples/qt3d/exampleresources"
    FILES
        ${envmaps_resource_files}
)
set(gltf_resource_files
    "../../../examples/qt3d/exampleresources/assets/gltf/2.0/RiggedFigure/RiggedFigure.gltf"
    "../../../examples/qt3d/exampleresources/assets/gltf/2.0/RiggedFigure/RiggedFigure0.bin"
    "../../../examples/qt3d/exampleresources/assets/gltf/2.0/RiggedSimple/RiggedSimple.gltf"
    "../../../examples/qt3d/exampleresources/assets/gltf/2.0/RiggedSimple/RiggedSimple0.bin"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/Wood_Cherry_Original_.jpg"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/_2004_old_vine_zinfandel_btl_xlg.jpg"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/artezin_bottle.jpg"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine.bin"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine.dae"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine.gltf"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine0FS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine0VS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine1FS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine1VS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine2FS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine2VS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine3FS.glsl"
    "../../../examples/qt3d/exampleresources/assets/gltf/wine/wine3VS.glsl"
)

qt_add_resources(rigged-simple "gltf"
    PREFIX
        "/"
    BASE
        "../../../examples/qt3d/exampleresources"
    FILES
        ${gltf_resource_files}
)

install(TARGETS rigged-simple
    BUNDLE DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Consider using qt_generate_deploy_app_script() for app deployment if
# the project can use Qt 6.3. In that case rerun qmake2cmake with
# --min-qt-version=6.3.
